class TeamController < ApplicationController

  def index
	@current_players = Team.current_players
  end

  def new
	@team = Team.new
  end

  def show
	@team = Team.find(params[:id])
  end

  def create
	@team = Team.new(params[:team])
	if @team.save
	  flash[:notice] = 'Player Added to Roster'
	  redirect_to :action => "index"
	else
	  render :action => "new"
	end
  end

  def destroy
	@team = Team.find(params[:id])
 	@team.destroy

 	flash[:notice] = 'Player removed from roster'
 	redirect_to :action => "index"
  end

  def update
	@team = Team.find(params[:id])

	if @team.update_attributes(params[:team])
	  flash[:notice] = 'Player successfully updated.'
	  redirect_to :action => "show", :id => params[:id]
	else
	  render :action => "edit"
	end
  end

  def edit
	@team = Team.find(params[:id])
  end
	
end
